/************************************************************************

								Heroes IV
					  Copyright 2000, The 3DO Company

	------------------------------------------------------------------
  						       creature_traits.h

	$Header: /game/creature_traits.h $

	$NoKeywords: $

 ************************************************************************/

#ifndef CREATURE_TRAITS_H_INCLUDED
#define CREATURE_TRAITS_H_INCLUDED

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

// kill the 255+ character identifier warning.  Templates tend to exceed that easily.
#pragma warning( disable: 4786 )

#include <bitset>
#include <string>
#include <vector>
#include "bitmap_layer_ptr.h"
#include "creature_ability.h"
#include "material_array.h"

enum t_creature_type;
enum t_missile_type;
enum t_town_building;
enum t_town_type;
enum t_spell;

typedef std::bitset<k_ability_count> t_ability_set;

struct t_creature_traits
{
	std::string						name;
	std::string						plural_name;
	std::string						name_with_article;
	std::string						plural_name_with_article;
	int								level;
	t_town_type						alignment;
	int								hit_points;
	int								damage_low;
	int								damage_high;
	float							attack_skill;
	float							defense_skill;
	int								movement;
	int								speed;
	int								shots;
	int								spell_points;
	int								spell_power; // in percentage of 1st level hero's power
	int								weekly_growth;
	int								experience;
	t_material_array				cost;
	std::string						short_help_text;
	std::string						help_text;
	t_town_building					dwelling;
	int								portrait_id;
	std::vector<t_creature_ability> abilities;
	t_ability_set                   ability_set;

	bool has_ability( t_creature_ability ability ) const;
};

enum t_article_type
{
	k_article_none,
	k_article_a,
	k_article_the,

	k_article_type_count
};

std::string					get_army_size_name( int amount, t_article_type article = k_article_a ); 
std::string					get_creature_name( t_creature_type creature, int amount,
										    bool include_article, bool upper_case = false );
t_bitmap_layer_ptr			get_creature_portrait( t_creature_type creature, int width );
t_spell						get_default_spell( t_creature_type creature );
t_missile_type				get_missile_type( t_creature_type creature );
t_creature_traits const&	get_traits( t_creature_type creature );


inline bool t_creature_traits::has_ability( t_creature_ability ability ) const
{
	return ability_set[ability];
}

inline bool				 has_ability( t_creature_type creature, t_creature_ability ability )
{
	return get_traits( creature ).has_ability( ability );
}

bool is_ownable( t_creature_type creature );
bool is_sea_creature( t_creature_type creature );

bool                     knows_spell( t_creature_type creature, t_spell spell );

#endif // CREATURE_TRAITS_H_INCLUDED